home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
BorderItems.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-06-09
|
2KB
|
114 lines
#ifdef __GNUG__
#pragma implementation
#endif
#include "BorderItems.h"
#include "Class.h"
#include "String.h"
#include "Look.h"
#include "TextItem.h"
#include "Math.h"
//---- Matte -------------------------------------------------------------------
NewMetaImpl(Matte,CompositeVObject, (T(border)));
Matte::Matte(VObject *in) : CompositeVObject(cIdNone, in, 0)
{
border= Point(20);
}
Matte::Matte(Point b, VObject *in) : CompositeVObject(cIdNone, in, 0)
{
border= b;
}
Matte::Matte(int id, Point b, VObject *in) : CompositeVObject(id, in, 0)
{
border= b;
}
void Matte::SetBorder(Point b)
{
border= b;
}
void Matte::SetOrigin(Point at)
{
VObject::SetOrigin(at);
At(0)->SetOrigin(at+border);
}
void Matte::SetExtent(Point e)
{
VObject::SetExtent(e);
e-= 2*border;
At(0)->SetExtent(e);
}
Metric Matte::GetMinSize()
{
VObject *inner= At(0);
Metric m= At(0)->GetMinSize();
SetFlag(eVObjHFixed, inner->TestFlag(eVObjHFixed));
SetFlag(eVObjVFixed, inner->TestFlag(eVObjVFixed));
return m.Expand(border);
}
OStream& Matte::PrintOn(OStream &s)
{
CompositeVObject::PrintOn(s);
return s << border SP;
}
IStream& Matte::ReadFrom(IStream &s)
{
CompositeVObject::ReadFrom(s);
return s >> border;
}
//---- BorderItem -------------------------------------------------------------------
NewMetaImpl0(BorderItem,CompositeVObject);
BorderItem::BorderItem(VObject *in) : CompositeVObject(cIdNone, in, 0)
{
}
BorderItem::BorderItem(VObject *ti, VObject *in) : CompositeVObject(cIdNone, in, ti, 0)
{
}
BorderItem::BorderItem(char *ti, VObject *in)
: CompositeVObject(cIdNone, in, new TextItem(ti), 0)
{
}
void BorderItem::SetOrigin(Point at)
{
VObject::SetOrigin(at);
gLook->GroupLayout()->SetOrigin(this, at);
}
void BorderItem::SetExtent(Point e)
{
VObject::SetExtent(e);
gLook->GroupLayout()->SetExtent(this, e);
}
Metric BorderItem::GetMinSize()
{
Metric m(gLook->GroupLayout()->GetMinSize(this));
SetFlag(eVObjHFixed, At(0)->TestFlag(eVObjHFixed));
SetFlag(eVObjVFixed, At(0)->TestFlag(eVObjVFixed));
return m;
}
void BorderItem::Draw(Rectangle r)
{
CompositeVObject::Draw(r);
gLook->GroupLayout()->Adorn(this, r, 0);
}